{literal}
  <script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will remove this page from the frontpage. Continue?"))
  {/literal}
document.location = "{$pagename}&action=delete&id=" + articleId;
{literal}
}
//-->
</script>
  {/literal}
{if $action!="edit" && $action!="new"}
{if $numfront > 0}
<h2>Frontpage Items</h2>
<div align="left"><input type="button" class="button" value="Add Item to Frontpage" onclick="window.location='{$pagename}&amp;action=new'" /></div>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
  <tr valign="top"> 
    <th width="10%" class="smallhead">Action</th>
    <th width="12%" class="smallhead">Name</th>
    <th width="12%" class="smallhead">Position</th>
  </tr>
 {section name=front loop=$numfront}
	  <tr valign="middle"> 
		<td width="10%"  class="text"><a href="{$pagename}&amp;id={$frontpages[front].id}&amp;action=edit"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {if $frontpages[front].function != "none"}{$frontpages[front].function}{else}{$frontpages[front].page}{/if}" title="Edit {if $frontpages[front].function != "none"}{$frontpages[front].function}{else}{$frontpages[front].page}{/if}" /></a> - <a href="javascript:confirmDelete({$frontpages[front].id})">
        <img src="{$tempdir}admin/images/delete.gif" border="0" alt="Remove {if $frontpages[front].function != "none"}{$frontpages[front].function}{else}{$frontpages[front].page}{/if} from frontpage" title="Remove {if $frontpages[front].function != "none"}{$frontpages[front].function}{else}{$frontpages[front].page}{/if} from frontpage" /></a></td>
		<td width="12%" class="text">{if $frontpages[front].function != "none"}Dynamic: {$frontpages[front].function}{else}Static: {$frontpages[front].page}{/if}</td>
        <td class="text">{if $smarty.section.front.iteration != 1}<a href="{$pagename}&amp;action=moveup&amp;id={$frontpages[front].id}"><img src="{$tempdir}admin/images/up.gif" border="0" alt="Up" title="Move Up" /></a>&nbsp;{/if}{if $smarty.section.front.iteration != $numfront}<a href="{$pagename}&amp;action=movedown&amp;id={$frontpages[front].id}"><img src="{$tempdir}admin/images/down.gif" border="0" alt="Up" title="Move Down" /></a>{/if}</td>
      </tr>  
    {/section}
</table>
{else}
<div align="center">No items on front page</div>
{/if}
<div align="left"><input type="button" class="button" value="Add Item to Frontpage" onclick="window.location='{$pagename}&amp;action=new'" /></div>
{elseif $action=="new" || $action=="edit"}<form name="form2" method="post" action="">
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
<tr>
<td class="text">
    Dynamic Content:
    <select name="functions" id="functions" class="inputbox" onchange="document.form2.pages.selectedIndex=0;">
      <option value="none" {if $item.function == '' || $item.function == 'none'}selected{/if}>Don't use dynamic content</option>
      {section name=function loop=$numfunc}
	  	<option value="{$func[function].name}" {if $item.function == $func[function].name}selected{/if}>{$func[function].name}</option>
	  {/section}
    </select>
    <br />
    <strong>OR</strong>
    <br />
    Static Content: 
    <select name="pages" id="pages" class="inputbox" onchange="document.form2.functions.selectedIndex=0;">
      <option value="none" {if $item.page == '' || $item.page == 'none'}selected{/if}>Don't use static content</option>
      {section name=pages loop=$numpages}
        <option value="{$page[pages].name}" {if $item.page == $page[pages].name}selected{/if}>{if $page[pages].friendly == ""}{$page[pages].name}{else}{$page[pages].friendly}{/if}</option> 
     {/section}	  
    </select>
    <br />
    <input type="submit" name="Submit" value="Submit" class="button" />
     <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
</td>
</tr>
</table>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-frontpage" target="_blank">Help</a>
</div>
